import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router);

export default new Router({
  mode:"history",
  routes: [
    {
      path: '/',
      name: 'login',
      component:resolve =>require(['@/view/page/Login'],resolve)
    },
    {
      path:'/layout',
      redirect:'/layout/sysChart'  //路由重定向，当访问/home的时候，直接定向到/home/userInfo
    },
    {
      path:'/layout',
      name:'layout',
      component:resolve =>require(['@/view/page/layout/Layout'],resolve),
      children:[
        {
          path:'sysChart',
          name:'sysChart',
          meta:{title:'系统首页'},
          component:resolve =>require(['@/view/page/layout/component/Schart'],resolve)
        },
        {
          path:'userInfo',
          name:'userInfo',
          meta:{title:'用户管理'},
          component:resolve =>require(['@/view/page/layout/component/user'],resolve)
        },
        {
          path:'catergory',
          name:'catergory',
          meta:{title:'分类管理'},
          component:resolve =>require(['@/view/page/layout/component/catergory'],resolve)
        },
        {
          path:'Content',
          name:'content',
          meta:{title:'内容页面'},
          component:resolve =>require(['@/view/page/layout/component/content'],resolve)
        },
        {
          path:'contentAdd',
          name:'contentAdd',
          meta:{title:'内容添加'},
          component:resolve =>require(['@/view/page/layout/component/content_add'],resolve)
        }
      ]
    },
    {
      path:'*',
      component:resolve =>require(['@/view/page/404.vue'],resolve)
    }
  ]
})
